package net.example.utils;

public class FileHelper {

    public static boolean isImgFile(String fileName)
    {
        String[] suffixNames=new String[]{".jpg",".png",".gif",".jpeg",".bmp"};
        return judgeFileName(fileName,suffixNames);
    }

    public static boolean isAudioFile(String fileName)
    {
        String[] suffixNames=new String[]{".mp3",".wma",".wav"};
        return judgeFileName(fileName,suffixNames);
    }

    //判断文件名称
    private static boolean judgeFileName(String fileName,String[] suffixNames)
    {
        fileName=fileName.toLowerCase();
        for (String suffiexName:suffixNames) {
            if(fileName.contains(suffiexName))
            {
                return true;
            }
        }
        return false;
    }
}
